//
//  EBMCheckImageView.m
//  eBondMall
//
//  Created by apple on 2020/6/5.
//  Copyright © 2020 zhaoshijie. All rights reserved.
//

#import "EBMCheckImageView.h"

@implementation EBMCheckImageView



/// 初始化方法
/// @param image 图片
- (instancetype)initWithImage:(UIImage *)image
{
    self = [super initWithFrame:[UIScreen mainScreen].bounds];
    if(self)
    {
        
        self.image = image;
        
        //  初始化视图
        [self initView];
        
        
    }
    return self;
    
}


#pragma mark ----------初始化视图----------
//  初始化视图
- (void)initView
{
    /// 设置大小和背景颜色
    [self createViewInFrameAndBackgroundColor];
    

    //  创建控件    图片
    [self createViewInImageView];
    


    //  创建手势    图片点击
    [self createTapInImage];
    
}


/// 设置大小和背景颜色
- (void)createViewInFrameAndBackgroundColor
{
    self.frame = [UIScreen mainScreen].bounds;
    
    self.backgroundColor = RGBCOLOR16_000000;
    
    
    
    
}

//  创建控件    图片
- (void)createViewInImageView
{
    
    
    
    self.bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
    [self addSubview:self.bgView];
    
    
    
    self.imageView = [[UIImageView alloc]initWithFrame:self.bgView.bounds];
    self.imageView.contentMode = UIViewContentModeScaleAspectFit;
    self.imageView.image = self.image;
    self.imageView.userInteractionEnabled = YES;
    [self.bgView addSubview:self.imageView];
    
    
    
}


//  创建手势    图片点击
- (void)createTapInImage
{
    UITapGestureRecognizer *tapG = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGClick:)];
    [self.imageView addGestureRecognizer:tapG];
}


#pragma mark --------------响应方法--------------


//  点击图片
- (void)tapGClick:(UITapGestureRecognizer *)sender
{
    
    [self removeToWindow];
    
    
}

@end
